/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poo.biblioteca.vistas.lectores;

/**
 *
 * @author apo
 */
public class PnlTipoLector extends javax.swing.JPanel {

    /**
     * Creates new form PnlTipoLector
     */
    public PnlTipoLector() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblIdTipoLector = new javax.swing.JLabel();
        txtIdTipoLector = new javax.swing.JTextField();
        txtNombreTipoLector = new javax.swing.JTextField();
        spnNumeroDiasPrestamo = new javax.swing.JSpinner();
        spnNumeroPrestamosSimultaneos = new javax.swing.JSpinner();
        lblNombreTipoLector = new javax.swing.JLabel();
        lblNumeroDiasPrestamo = new javax.swing.JLabel();
        lblNumeroPrestamosSimultaneos = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        lblIdTipoLector.setText("Id:");

        txtIdTipoLector.setEnabled(false);

        spnNumeroDiasPrestamo.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), null, Integer.valueOf(100), Integer.valueOf(1)));

        spnNumeroPrestamosSimultaneos.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), null, Integer.valueOf(3), Integer.valueOf(1)));

        lblNombreTipoLector.setText("Tipo de Lector:");

        lblNumeroDiasPrestamo.setText("# máximo de días de préstamo:");

        lblNumeroPrestamosSimultaneos.setText("# máximo de ptmos simultáneos:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblIdTipoLector)
                    .addComponent(lblNombreTipoLector)
                    .addComponent(lblNumeroDiasPrestamo)
                    .addComponent(lblNumeroPrestamosSimultaneos))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(txtIdTipoLector)
                        .addComponent(spnNumeroDiasPrestamo, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtNombreTipoLector, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(spnNumeroPrestamosSimultaneos, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblIdTipoLector)
                    .addComponent(txtIdTipoLector, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNombreTipoLector, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNombreTipoLector))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(spnNumeroDiasPrestamo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNumeroDiasPrestamo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(spnNumeroPrestamosSimultaneos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNumeroPrestamosSimultaneos)))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel lblIdTipoLector;
    private javax.swing.JLabel lblNombreTipoLector;
    private javax.swing.JLabel lblNumeroDiasPrestamo;
    private javax.swing.JLabel lblNumeroPrestamosSimultaneos;
    private javax.swing.JSpinner spnNumeroDiasPrestamo;
    private javax.swing.JSpinner spnNumeroPrestamosSimultaneos;
    private javax.swing.JTextField txtIdTipoLector;
    private javax.swing.JTextField txtNombreTipoLector;
    // End of variables declaration//GEN-END:variables

    //ID
    public int getIdTipoLector() {
        return Integer.parseInt(txtIdTipoLector.getText());
    }

    public void setIdTipoLector(int idTipoLector) {
        txtIdTipoLector.setText(Integer.toString(idTipoLector));
    }
    //Nombre

    public String getNombreTipoLector() {
        return txtNombreTipoLector.getText();
    }

    public void setNombreTipoLector(String nombreTipoLector) {
        txtNombreTipoLector.setText(nombreTipoLector);
    }
    //NumeroDiasPrestamo

    public int getNumeroDiasPrestamo() {
        return Integer.parseInt(spnNumeroDiasPrestamo.getValue().toString());
    }

    public void setNumeroDiasPrestamo(int numeroDiasPrestamo) {
        spnNumeroDiasPrestamo.setValue(numeroDiasPrestamo);
    }
    //NumeroMaxPrestamosSimultaneos

    public int getNumeroMaxPrestamosSimultaneos() {
        return Integer.parseInt(spnNumeroPrestamosSimultaneos.getValue().toString());
    }

    public void setNumeroMaxPrestamosSimultaneos(int numeroMaxPrestamosSimultaneos) {
        spnNumeroPrestamosSimultaneos.setValue(numeroMaxPrestamosSimultaneos);
    }

    public void limpiarCampos() {
     
        txtIdTipoLector.setText("");
        txtNombreTipoLector.setText("");
        spnNumeroDiasPrestamo.setValue(0);
        spnNumeroPrestamosSimultaneos.setValue(0);
       
        txtNombreTipoLector.requestFocusInWindow();

    }
}
